/**
 * @author David Young
 */
package csab.tests.utility;

import java.text.DecimalFormat;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;

import csab.core.Collidable;
import csab.core.Sprite;

/**
 * This is a utility Sprite designed for use within classes of
 * the csab.tests package (and its' sub-packages).
 * @author David Young
 */
public class TestSprite extends Sprite {
	private static final DecimalFormat df = new DecimalFormat("#.##");
	private int collisioncount;
	/**
	 * Constructor for an object of this class.
	 */
	public TestSprite() {
		super("Test Sprite");
		this.setWidth(10);
		this.setHeight(10);
		collisioncount = 0;
	}

	/* (non-Javadoc)
	 * @see csab.core.Entity#destroy()
	 */
	@Override
	public void destroy() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#doCollide(csab.core.Collidable)
	 */
	@Override
	public void doCollide(Collidable obj) {
		collisioncount++;
	}
	
	/**
	 * Return the number of collisions that this
	 * object has undergone.
	 * @return The number of collisions experienced
	 * by this object.
	 */
	public int getCollisionCount()
	{
		return collisioncount;
	}

	/* (non-Javadoc)
	 * @see csab.core.Entity#draw(int, int)
	 */
	@Override
	public void draw(int x, int y, Graphics g) {
		g.setColor(Color.red);
		g.fillOval(x, y, 10, 10);
		g.setColor(Color.yellow);
		g.drawString("(" + 
					 df.format(this.getX()) + 
					 ", "+
					 df.format(this.getY()) +
					 ")", x, y - 20);
	}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#idle(int)
	 */
	@Override
	public void idle() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#jump(int)
	 */
	@Override
	public void jump() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#moveLeft(int)
	 */
	@Override
	public void moveLeft() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#moveRight(int)
	 */
	@Override
	public void moveRight() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#doAction(int)
	 */
	@Override
	public void doAction(int delta) {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#canAttack()
	 */
	@Override
	public boolean canAttack() {
		return false;
	}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#doAttack()
	 */
	@Override
	public void doAttack() {}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#prepareAttack()
	 */
	@Override
	public void prepareAttack() {
	}

	/* (non-Javadoc)
	 * @see csab.core.Sprite#readyToAttack()
	 */
	@Override
	public boolean readyToAttack() {
		return false;
	}

}
